package Task2;

import java.util.ArrayList;

public class EmailService {

	public static void main(String[] args) {
		Queue queue = new Queue();
		ArrayList<Email> al = new ArrayList<>();
		al.add(new Email("Ivanova"));
		al.add(new Email("Petrova"));
		al.add(new Email("Sidorova"));
		al.add(new Email("Antonova"));
		EmailAdder ea = new EmailAdder(queue, al);

		new Thread(ea).start();
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		EmailSender es = new EmailSender(queue);
		new Thread(es).start();
		ea.stopWork();
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		es.stopWork();

	}

}
